
#ifndef __DRV_SPI_DEFINITIONS__
#define __DRV_SPI_DEFINITIONS__
#include "gd32f4xx_spi.h"

typedef void (*SpiWriteFun)(uint16_t);
typedef uint16_t (*SpiReadFun)(void);

/* SPI init parameter struct definitions */
typedef struct spi_init_tag
{
    uint32_t spi_periph;           /*!< SPIx(x=0,1,2,3,4,5) */
    uint32_t device_mode;          /*!< SPI master or slave */
    uint32_t trans_mode;           /*!< SPI transtype */
    uint32_t frame_size;           /*!< SPI frame size */
    uint32_t nss;                  /*!< SPI nss control by handware or software */
    uint32_t endian;               /*!< SPI big endian or little endian */
    uint32_t clock_polarity_phase; /*!< SPI clock phase and polarity */
    uint32_t prescale;             /*!< SPI prescale factor */

    SpiWriteFun write_fun; /*!< SPI write function */
    SpiReadFun read_fun;   /*!< SPI read function */
} spi_init_t;

#endif /* __DRV_SPI_DEFINITIONS__ */
